package com.eightbears.beboy.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.R;
import com.eightbears.beboy.entity.ProductsEntity;

/**
 * Created by Bao on 2016/12/7.
 */

public class CommodityListAdapter extends BaseQuickAdapter<ProductsEntity, BaseViewHolder> {

    public CommodityListAdapter() {
        super(R.layout.item_commodity, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ProductsEntity productsEntity) {
        baseViewHolder.setText(R.id.tv_commondity_title, productsEntity.getTitle())
                .setText(R.id.tv_commondity_price, productsEntity.getMoney())
                .addOnClickListener(R.id.ll_root);
        Glide.with(mContext).load(productsEntity.getCover()).crossFade().placeholder(R.mipmap.shop_pic).
                into((ImageView) baseViewHolder.getView(R.id.iv_products));
    }
}
